# deco.py
#装饰器演示

from time import ctime, sleep

def tsfunc(func):
    def wrappedFunc():
        print(ctime()+'----'+func.__name__+' called')
        return func()
    return wrappedFunc

@tsfunc
def foo():
    print('dosth')

foo()
sleep(4)

for i in range(2):
    sleep(1)
    foo()

#运行结果
#Fri Apr  8 09:05:04 2016----foo called
#dosth
#Fri Apr  8 09:05:09 2016----foo called
#dosth
#Fri Apr  8 09:05:10 2016----foo called
#dosth
